import httpUtils from "../../../commons/utils/FeatchUtils";
import {basicUrl} from "../../../configs/DefaultConfig";
import {convertDataToFormData} from "../../../commons/utils/CommonUtils";

export async function getAllFeatureByPage(params = {}) {
    Object.assign(params,{sortOrders:[{property:'code',direction:'ASC'}],quickSearchProperties:["code","name"]});
    return httpUtils.postJson(basicUrl + "/feature/findByPage", params);
}

export async function findFeatureByFeatureGroupId(params={}){
    params.featureType = "Page";
    return httpUtils.get(basicUrl+"/feature/findByFeatureGroupAndType",params);
}
export async function saveFeature(params = {}) {
    return httpUtils.postJson(basicUrl + "/feature/save",params);
}

export async function deleteFeature(param=''){
    return httpUtils.delete(basicUrl+"/feature/delete",param);
}

export async function listAllFeatureGroup(params = {}) {
    return httpUtils.get(basicUrl + "/featureGroup/findAll", params);
}
export async function listChildByFeatureId(params = {}) {
    return httpUtils.get(basicUrl + "/feature/findChildByFeatureId", params);
}

export async function saveFeatureGroup(params = {}) {
    return httpUtils.postJson(basicUrl + "/featureGroup/save",JSON.stringify(params));
}

export async function deleteFeatureGroup(param=''){
    return httpUtils.delete(basicUrl+"/featureGroup/delete",param);
}
